#!/bin/sh
nodevars
cd `dirname $0`/..

srcDir="src[\\\/]"
distDir=""

src=$1
dist=`echo $src | sed "s/$srcDir/$distDir/g"`

if [ "$src" = "$dist" ]; then
    echo "Ignore : $src"
    exit 0
fi

dist=`dirname $dist`

srcExtName=${src##*.}
distExtName=''
cmd=''

mkdir -p $dist
case $srcExtName in
    jade)
            cmd="jade -P $src -o $dist"
        ;;
    coffee)
            cmd="coffee -c  -o $dist $src"
        ;;
        *)
            cmd="cp $src $dist/"
        ;;
esac
echo "exec: $cmd"
exec $cmd